package net.pulseproject.router.config.instantiator.builder.validator;

public abstract class SkeletonFieldValidator implements FieldValidator {

	private FieldValidator nextValidator;
	
	
	@Override
	public final void setNextValidator(final FieldValidator nextValidator) {
		if(this.nextValidator != null) {
			throw new IllegalStateException("nextValidator already set!");
		}
		
		this.nextValidator = nextValidator;
	}

	@Override
	public final void validate() {
		this.validateFields();
		
		if(this.nextValidator != null) {
			this.nextValidator.validate();
		}
	}
	
	protected abstract void validateFields();

}
